
import { Store, createStore } from 'vuex';

const _s: Store<Memory.LovePagStore> = createStore({
    
    state: <Memory.LovePagStore>{
        num: 0,
        ioading: false
    },
    getters: {
        
    },
    mutations: {
        __change: (s: ONE, v: ANYS) => s[ v[0] ] = v[1],
        __num: (s: ONE) => { s.num = s.num + 1; },
    },

    actions: {
        // 使用案例，vuex.dispatch('change', [ 'ioading', -1 ])
        // 或者 authReFresh('ioading', -1)
        change: (c: ONE, vs: ANYS) => (c.state[ vs[0] ] = vs[1]),
        // 开启刷新
        refresh: (c: ONE) => { c.commit('__num') },
    }
})

export default _s